public class Complex {
    private double m_dRealPart;
    private double m_dImaginaryPart;
    public Complex(double m_dRealPart,double m_dImaginaryPart){
        this.m_dRealPart = m_dRealPart;
        this.m_dImaginaryPart = m_dImaginaryPart;
    }

    public void Complex(){
        this.m_dRealPart = 0;
        this.m_dImaginaryPart = 0;
    }
    public void Complex(double r,double i){
        this.m_dRealPart = r;
        this.m_dImaginaryPart = i;
    }
    public double GetRealPart(){
        return this.m_dRealPart;
    }
    public double GetImaginaryPart(){
        return this.m_dImaginaryPart;
    }
    public void SetRealPart(double d){
        this.m_dRealPart = d;
    }
    public void SetImaginaryPart(double d){
        this.m_dImaginaryPart = d;
    }
    public Complex Add(Complex c){
        return new Complex(m_dRealPart+c.m_dRealPart,m_dImaginaryPart+c.m_dImaginaryPart);
    }
    public Complex Minus(Complex c){
        return new Complex(m_dRealPart-c.m_dRealPart,m_dImaginaryPart-c.m_dImaginaryPart);
    }

    public Complex Multi(Complex c){
        return new Complex(m_dRealPart*c.m_dRealPart-m_dImaginaryPart*c.m_dImaginaryPart,
                m_dRealPart*c.m_dImaginaryPart+m_dImaginaryPart*c.m_dRealPart);
    }
    public String toString(){
        String s;
        if (m_dRealPart != 0.0){
            if (m_dImaginaryPart > 0)
                s = new Float(m_dRealPart).toString() + "+" + new Float(m_dImaginaryPart).toString() + "i";
            else if (m_dImaginaryPart < 0)
                s = new Float(m_dRealPart).toString() + "-" + new Float(-1*m_dImaginaryPart).toString() + "i";
            else
                s = new Float(m_dRealPart).toString();
        }
        else {
            if (m_dImaginaryPart > 0)
                s = new Float(m_dImaginaryPart).toString() + "i";
            else if (m_dImaginaryPart< 0)
                s = new Float(-1*m_dImaginaryPart).toString() + "i";
            else
                s = new Float(m_dRealPart).toString();
        }
        return
    }